---
description: Information about adding Hasura Data Connectors
sidebar_label: Add Data Connectors
keywords:
  - hasura
  - docs
  - databases
  - data connectors
  - add
sidebar_position: 2
---

import Thumbnail from '@site/src/components/Thumbnail';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Add a Hasura GraphQL Data Connector Agent to Metadata

To use a custom Hasura GraphQL Data Connector Agent, follow the following steps in the Hasura Console to add it to the
Hasura GraphQL Engine metadata. Before following the steps, make sure the custom connector is deployed and accessible.

<Tabs groupId="user-preference" className="api-tabs">

<TabItem value="console" label="Console">
<ol>
<li>

Navigate to the Data tab in the project's Console.

<Thumbnail src="/img/databases/data-connector/data-tab.png" alt="Hasura GraphQL Data Connector Agent diagram" />
</li>
<li>

Click on the `Manage` button.

<Thumbnail
  src="/img/databases/data-connector/manage-db.png"
  alt="Hasura GraphQL Data Connector Agent diagram"
/>
</li>
<li>

Click on the `Data Connector Agents` button.

<Thumbnail
  src="/img/databases/data-connector/connect-agent.png"
  alt="Hasura GraphQL Data Connector Agent diagram"
/>
</li>
<li>

Click on the `Add Agent` button.

<Thumbnail
  src="/img/databases/data-connector/add-agent.png"
  alt="Hasura GraphQL Data Connector Agent diagram"
/>
</li>
<li>

Enter the values for agent name and agent URL. You can also choose to put the agent URL in an environment variable instead and use that variable name here. Click `Connect` and you're done!

<Thumbnail
  src="/img/databases/data-connector/connect-final.png"
  alt="Hasura GraphQL Data Connector Agent diagram"
/>
</li>
<li>

Once the above is done, the new driver supported by the custom connector will be available as one of the options
in the `Connect Database` page.

<Thumbnail
  src="/img/databases/data-connector/updated-driver-list.png"
  alt="Hasura GraphQL Data Connector Agent diagram"
/>
</li>
</ol>
</TabItem>

<TabItem value="cli" label="CLI">

You can add a Data Connector Agent by adding its config to the `/metadata/backend_configs.yaml` file:

```yaml
dataconnector:
  sqlite:
    uri: <data-connector-agent-url>
```

Alternatively, you can provide the Data Connector Agent URL via an environment variable:

```yaml
dataconnector:
  sqlite:
    uri:
      from_env: <data-connector-agent-url-environment-variable-name>
```

Apply the Metadata by running:

```yaml
hasura metadata apply
```

</TabItem>

<TabItem value="api" label="API">

You can add a Data Connector Agent to Hasura via the `dc_add_agent` Metadata API.

```http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
  "type": "dc_add_agent",
  "args": {
      "name": "sqlite",
      "url": "<url-where-data-connector-agent-is-deployed>"
  }
}
```

Alternatively, you can provide the Data Connector Agent URL via an environment variable:

```http
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin

{
  "type": "dc_add_agent",
  "args": {
      "name": "sqlite",
      "url": {
        "from_env": "<data-connector-agent-url-environment-variable-name>"
      }
  }
}
```

</TabItem>
</Tabs>
